package com.youlin;

import org.redisson.api.RBlockingQueue;
import org.redisson.api.RedissonClient;
import org.redisson.api.annotation.RInject;
import org.redisson.client.codec.IntegerCodec;
import org.redisson.client.codec.LongCodec;

import java.io.Serializable;
import java.util.concurrent.TimeUnit;

public class MyRedissonTask implements Runnable, Serializable {

    @RInject
    private RedissonClient redissonClient;

    @Override
    public void run() {
        RBlockingQueue<Long> blockingQueue001 = redissonClient.getBlockingQueue("ABC", LongCodec.INSTANCE);
        blockingQueue001.add(System.currentTimeMillis());
        try {
            TimeUnit.MILLISECONDS.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        blockingQueue001.add(System.currentTimeMillis());
        try {
            TimeUnit.MILLISECONDS.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        blockingQueue001.add(System.currentTimeMillis());
    }

}
